#include "main.hpp"
#include "Thread.h"





void guidisplayimg(const uint16 *p, uint16 width, uint16 height, uint16 dis_width, uint16 dis_height)
{
    uint32 i,j;
    uint16 color = 0;

    ips200_address_set(0,0,dis_width-1,dis_height-1);//������ʾ���� 
    
    for(j=0;j<dis_height;j++)
    {
        for(i=0;i<dis_width;i++)
        {
            color = *(p+(j*height/dis_height)*width+i*width/dis_width);//��ȡ���ص�
            color = ((color&0xff)<<8) | (color>>8);
            ips200_wr_data16(color); 
        }
    }
}
uint8_t guiflag=0;
static void guiThreadEntry(void*) {
using namespace artVcontact;
	
//  guidisplayimg(&Hesha[0], 320,240 , 320, 240);
	while(1)
	{

	// if(gpio_get(D4)==0)
	// {		
	// 	guiflag=1;
		// Anotc_SendData();
// 		ips200_showstr(248,12,"YA");
// //		ips200_showstr(248,13,"MG");

// 		ips200_showfloat(272,12,yaw,3,2);
// //		ips200_showfloat(272,13,MagYaw,3,2);
// 		ips200_showstr(248,0,"S1");
// 		ips200_showstr(248,1,"S2");
// 		ips200_showstr(248,2,"S3");
// 		ips200_showstr(248,3,"S4");
// 		ips200_showint16(272,0,LGH_Motor1.Encoder_Delta);
// 		ips200_showint16(272,1,LGH_Motor2.Encoder_Delta);
// 		ips200_showint16(272,2,LGH_Motor3.Encoder_Delta);
// 		ips200_showint16(272,3,LGH_Motor4.Encoder_Delta);

// 		ips200_showstr(248,4,"D1");
// 		ips200_showstr(248,5,"D2");
// 		ips200_showstr(248,6,"D3");
// 		ips200_showstr(248,7,"D4");
// 		ips200_showint32(264,4,LGH_Motor1.Dutycycle,7);
// 		ips200_showint32(264,5,LGH_Motor2.Dutycycle,7);
// 		ips200_showint32(264,6,LGH_Motor3.Dutycycle,7);
// 		ips200_showint32(264,7,LGH_Motor4.Dutycycle,7);
	
		
// 		ips200_showstr(248,8,"E1");
// 		ips200_showstr(248,9,"E2");
// 		ips200_showstr(248,10,"E3");
// 		ips200_showstr(248,11,"E4");

// 		ips200_showint32(272,8,LGH_Motor1.Encoder_Sum,6);
// 		ips200_showint32(272,9,LGH_Motor2.Encoder_Sum,6);
// 		ips200_showint32(272,10,LGH_Motor3.Encoder_Sum,6);
// 	  	ips200_showint32(272,11,LGH_Motor4.Encoder_Sum,6);
		
// 		ips200_showint32(140,11,Car_Encoder_SumX,7);
//		ips200_showint32(140,12,Car_Encoder_SumY,7);
//		ips200_showint32(140,13,Car_Encoder_SumZ,7);
		
  }
		
	// else 
	// {
	// 	if(guiflag==1)
	// 	{
	// 	guiflag=0;

	// 	}
	// }
	//rt_thread_mdelay(40);
		

	// }
}

// rtthread::Thread guiThread(guiThreadEntry, NULL, 1024, 25, 500, "guiThread");

